<template>
	<view>
		<view class="txhead">
			<view class="txhead_1"> 可提现(元) </view>
			<view class="txhead_2"> <text>¥</text> {{user.money}} </view>
		</view>
		
		<view class="txlist" v-if="show==1" >
			
			<view class="txlist_box">
				
				<view class="tx_title"> 提现金额 </view>
				<view class="tx_intput">
						<input type="text" @input="getmoney" placeholder="请输入" >
				</view>
			</view>
			
			<view class="txlist_box">
				<view class="tx_title"> 提现账号 </view>
				<view class="tx_intput">
						<input type="text" @input="getorder" placeholder="请输入支付宝账号" >
				</view>
			</view>
			
			<view class="txlist_box">
				<view class="tx_title"> 账号名称 </view>
				<view class="tx_intput">
						<input type="text" @input="getname" placeholder="请输入名称" >
				</view>
			</view>
			
			
			<view class="tx_btn" @tap="submits"> 立即提现 </view>
			
			<view style="height: 10rpx;"></view>
		</view>
		
		
		<view class="kaitong" v-if="show==1">
			<text class="icon-wancheng iconfont" @tap="setstatus0" v-if="status==1"></text>
			<text class="icon-xuanzekuangmoren iconfont" @tap="setstatus1" v-if="status!=1"></text>
			 知悉并同意 <text class="cicons" @tap="seexieyi" >《隐私协议》</text> 
		</view>
		
		<view class="tx_desc" v-if="show==1">
			
			<view class="tx_desc1"> 1.提现金额不能低于100 </view>
			<view class="tx_desc1"> 2.提现到期时间T+1,节假日顺延 </view>
		</view>
	</view>
</template>

<script>
	
	
	import {curl} from 'common/api.js';
	import {baseUrl} from "common/config.js";
	
	export default {
		data() {
			return {
				user:'',
				order:'',
				name:'',
				money:'',
				status:0,
				show:0
			}
		},
		
		onShow() {
			
			// 查看是否已经申请过了 
			var that=this;
			curl('member/getuserinfo', {}).then((res) => {
				this.user=res.data;
			});
			
			curl('index/getshow', {}).then((res) => {
				this.show=res.data.show;
			});
		},
		
		
		methods: {
			
			setstatus1(){
				console.log('0000000')
				this.status=1
			},
			setstatus0(){
				this.status=0
			},
			seexieyi(){
				uni.navigateTo({
					url:'/pages/down/xieye'
				})
			},
			
			submits(){
				
				var money=this.money;
				var name=this.name;
				var order=this.order;
				var status=this.status;
				
				
				if(status!=1){
					
					uni.showToast({
						icon:'none',
						title:'请同意协议'
					})
					return false;
				}
				
				
				var that=this;
				curl('daili/tixianapply', {money:money,name:name,order:order}).then((res) => {
					console.log(res)
					
					if (res.code==0) {
						uni.showToast({
							title:res.msg,
							icon:'none'
						})
					} else{
						uni.showToast({
							title:res.msg,
							icon:'none'
						})
						
						setTimeout(function(){
							uni.reLaunch({
								url:"/pages/down/logs"
							})
						})
						
					}	
					
				});
				
			},
			
			
			getorder(ret){
				this.order=ret.detail.value
			},
			getname(ret){
				this.name=ret.detail.value
			},
			getmoney(ret){
				this.money=ret.detail.value
			}
		}
	}
</script>

<style>
	
	
	
	.kaitong>.iconfont{
		margin-right: 5rpx;font-size: 28rpx;
	}
	.icon-wancheng{
		color: #08b059;
	}
	.cicons{
		color: #08b059;
	}
	.kaitong{
		width: 700rpx;height: 90rpx;
		line-height: 90rpx;margin: auto;
		font-size: 28rpx;color: #666666;font-weight: 500;
	}
	
	.tx_desc1{
		margin: 10rpx auto;
		font-size: 25rpx ;color: #666666;
	}
	.tx_desc{
		width: 700rpx;height: auto;margin: auto;margin-top: 60rpx;
	}
	.tx_btn{
		width: 640rpx;height: 80rpx;margin: 50rpx auto;
		background: #08b059;border-radius: 80rpx;
		text-align: center;line-height: 80rpx;
		color: #ffffff;
	}
	
	.tx_intput,.tx_intput>input{
		height: 60rpx;line-height: 60rpx;
		font-size: 28rpx;font-weight: 500;color: #555555;
	}
	.tx_title{
		height: 80rpx;line-height: 90rpx;
		font-size: 28rpx;font-weight: 500;color: #555555;
	}
	.txlist_box{
		width: 640rpx;height: 150rpx;margin: auto;
		border-bottom: 1px solid #ececec;
	}
	.txlist{
		width: 700rpx;margin: auto;margin-top: -100rpx;
		background: #ffffff;border-radius: 10rpx;
		box-shadow: 0px 1px 10px 0px rgba(50, 50, 50, 0.175);
	}
	
	.txhead_2>text{
		font-size: 24rpx;margin-right: 5rpx;
	}
	.txhead_2{
		width: 680rpx;height: 70rpx;margin: auto;
		color: #ffffff;font-size: 44rpx;line-height: 70rpx;font-weight: bold;
	}
	.txhead_1{
		width: 680rpx;height: 100rpx;margin: auto;
		color: #ffffff;font-size: 24rpx;line-height: 140rpx;
	}
	.txhead{
		width: 100%;height: 300rpx;
		background: #08b059;
	}
</style>
